package com.zh.mp.demo.response;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result<T> implements Serializable {

    private static final long serialVersionUID = -2354377668069235864L;
    public int code;
    private T data;
    private String message = "调用成功！";

    public Result(T data){
        this.data = data;
    }
    public Result(int code, String message){
        this.code = code;
        this.message = message;
    }

    public static Result<?> fail(String message) {
        return new Result<>(500,message);
    }
}
